{% extends "backend/base.html" %}
{% block title %}
    编辑时间线
{% endblock %}
{% block content %}
    <main>
        <div class="container">
            {% include "_flash.html" %}
            <div class="table-responsive">
                {% if timelines %}
                    <table class="table table-hover">
                    <thead>
                    <tr>
                        <th>标题</th>
                        <th>内容</th>
                        <th>时间</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for timeline in timelines %}
                        <tr>
                            <td><i class="fa fa-tree"></i> {{ timeline.title }}</td>
                            <td>{{ timeline.content|safe }}</td>
                            <td><i class="fa fa-calendar"></i> {{ (timeline.timestamp|split)[0] }}</td>
                            <td>
                                {% if timeline.abandon == 0 %}
                                    <i class="fa fa-star"></i> 启用
                                {% else %}
                                    <i class="fa fa-lock"></i> 遗弃
                                {% endif %}
                            </td>
                            <td>
                                {% if timeline.abandon == 0 %}
                                    <button class="btn btn-danger" style="margin-bottom: 3px;"><a title="遗弃该里程碑" style="color: inherit; text-decoration: none;" href="/backend/timeline/abandon-or-activate/{{ timeline.id }}/">遗弃</a></button>
                                {% else %}
                                    <button class="btn btn-success" style="margin-bottom: 3px;"><a title="启用该里程碑" style="color: inherit; text-decoration: none;" href="/backend/timeline/abandon-or-activate/{{ timeline.id }}/">启用</a></button>
                                {% endif %}
                                <button class="btn btn-info" style="margin-bottom: 3px;"><a title="编辑里程碑信息" style="color: inherit; text-decoration: none;" href="/backend/timeline/info-edit/{{ timeline.id }}/">编辑</a></button>
                            </td>
                        </tr>
                    {% endfor %}
                {% endif %}
                </tbody>
                </table>
            </div>
        </div>
    </main>
{% endblock %}